﻿using Servicos;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace UI.Views.Configuracaoes
{
    /// <summary>
    /// Interaction logic for frmConfiguracoes.xaml
    /// </summary>
    public partial class frmConfiguracoes : Window
    {
        public static string connectionString = null;
        public frmConfiguracoes()
        {
            InitializeComponent();
        }

        private void ConectarBanco(object sender, RoutedEventArgs e)
        {
            connectionString = @"Data Source=" + txtServidor.Text + ";Initial Catalog=" + txtBanco.Text + "; Integrated Security=true";
            var ArquivoBanco = Directory.GetCurrentDirectory() + @"\Configuracao.txt";
            if (!File.Exists(ArquivoBanco))
            {
                System.IO.File.Create(ArquivoBanco).Close();
                System.IO.File.AppendAllText(ArquivoBanco, connectionString);
                DexGerencial.Utils.Restart();
                DexGerencial.Utils.Kill();
            }
           
        }
    }
}
